package gestionTransportObjetsGenerated;

/**
 * Interface definition : GestionColis
 * 
 * @author OpenORB Compiler
 */
public abstract class GestionColisPOA extends org.omg.PortableServer.Servant
        implements GestionColisOperations, org.omg.CORBA.portable.InvokeHandler
{
    public GestionColis _this()
    {
        return GestionColisHelper.narrow(_this_object());
    }

    public GestionColis _this(org.omg.CORBA.ORB orb)
    {
        return GestionColisHelper.narrow(_this_object(orb));
    }

    private static String [] _ids_list =
    {
        "IDL:gestionTransportObjetsGenerated/GestionColis:1.0"
    };

    public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte [] objectId)
    {
        return _ids_list;
    }

    public final org.omg.CORBA.portable.OutputStream _invoke(final String opName,
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler)
    {

        if (opName.equals("connaitreEtat")) {
                return _invoke_connaitreEtat(_is, handler);
        } else if (opName.equals("informerColisDestinataire")) {
                return _invoke_informerColisDestinataire(_is, handler);
        } else if (opName.equals("newColis")) {
                return _invoke_newColis(_is, handler);
        } else if (opName.equals("obtenirColis")) {
                return _invoke_obtenirColis(_is, handler);
        } else if (opName.equals("obtenirColisDest")) {
                return _invoke_obtenirColisDest(_is, handler);
        } else {
            throw new org.omg.CORBA.BAD_OPERATION(opName);
        }
    }

    // helper methods
    private org.omg.CORBA.portable.OutputStream _invoke_connaitreEtat(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = _is.read_string();

        gestionTransportObjetsGenerated.EtatColis[] _arg_result = connaitreEtat(arg0_in);

        _output = handler.createReply();
        gestionTransportObjetsGenerated.EtatColisListHelper.write(_output,_arg_result);

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_newColis(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        gestionTransportObjetsGenerated.Enveloppe arg0_in = gestionTransportObjetsGenerated.EnveloppeHelper.read(_is);

        newColis(arg0_in);

        _output = handler.createReply();

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_obtenirColis(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = _is.read_string();

        try
        {
            gestionTransportObjetsGenerated.Enveloppe _arg_result = obtenirColis(arg0_in);

            _output = handler.createReply();
            gestionTransportObjetsGenerated.EnveloppeHelper.write(_output,_arg_result);

        }
        catch (gestionTransportObjetsGenerated.COLIS_INCONNU _exception)
        {
            _output = handler.createExceptionReply();
            gestionTransportObjetsGenerated.COLIS_INCONNUHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_informerColisDestinataire(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = _is.read_string();
        String arg1_in = _is.read_string();

        informerColisDestinataire(arg0_in, arg1_in);

        _output = handler.createReply();

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_obtenirColisDest(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = _is.read_string();

        String[] _arg_result = obtenirColisDest(arg0_in);

        _output = handler.createReply();
        gestionTransportObjetsGenerated.EnveloppesDestHelper.write(_output,_arg_result);

        return _output;
    }

}
